<template>
    <!-- <el-card style="width: 100%;margin-bottom: 20px;">
       <el-form :inline="true" :model="formInline" class="demo-form-inline">
            <el-form-item label="">
                <el-input v-model="formInline.name" placeholder="职位名称" clearable />
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">查询</el-button>
            </el-form-item>
        </el-form>
    </el-card> -->
    <el-card style="width: 100%">
        <el-table :data="list" style="width: 100%">
            <el-table-column prop="nickname" label="用户昵称" width="150" />
            <el-table-column prop="name" label="真实姓名" width="150" />
            <el-table-column prop="deliveryPositionName" label="投递岗位" width="150" />
            <el-table-column prop="address" label="居住地址" width="120" />
            <el-table-column prop="email" label="邮箱" width="120" />
            <el-table-column prop="skill" label="专业技能" width="220" />
            <el-table-column prop="minSalaryExpect" label="最低期望薪资" width="120" />
            <el-table-column prop="maxSalaryExpect" label="最高期望薪资" width="120" />
            <el-table-column prop="areaName" label="所在地" width="600" />
            <el-table-column fixed="right" label="操作" min-width="80">
                <template #default="scope">
                    <el-button link type="primary" size="small" @click="onDetail(scope.row.memberUserId)">详情</el-button>
                </template>
            </el-table-column>
        </el-table>
        <div style="display: flex;justify-content: flex-end;margin-top: 20px;">
            <el-pagination
                background
                layout="prev, pager, next"
                :total="total"
                @current-change="handleCurrentChange"
            />
        </div>
    </el-card>
    <RecruitmentResumeDeliveryForm ref="formRef" />
    
</template>
<script setup>
import RecruitmentResumeDelivery from './subModule/resumedelivery/index.vue'
import RecruitmentResumeDeliveryForm from '@/components/Hospital/resumedelivery/RecruitmentResumeDeliveryForm.vue'
import { ref, reactive, onMounted } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus'
import { RecruitmentPositionApi } from '@/api/hospital/recruitment.position'
const formInline = reactive({
  pageNo: 1,
  pageSize: 10
})
const total = ref(0);
const list = ref([]);

/** 岗位候选人 */
const formRef= ref()


onMounted(()=>{
    onLoadData();
})

const onLoadData = () => {
    RecruitmentPositionApi.getRecruitmentResumePage(formInline)
        .then(res=>{
            console.log('res', res);
            total.value = res.total;
            list.value = res.list;
        })
}

const onSubmit = () => {
    formInline.pageNo = 1;
    onLoadData();
}
const handleClick = (id) => {
  console.log('click')
  ElMessageBox.confirm(
    '确定删除吗?',
    'Warning',
    {
      confirmButtonText: 'OK',
      cancelButtonText: 'Cancel',
      type: 'warning',
    }
  )
    .then(() => {
        RecruitmentPositionApi.deleteRecruitmentPosition(id)
            .then(res=>{
                ElMessage({
                    type: 'success',
                    message: '删除成功',
                });
                formInline.pageNo = 1;
                onLoadData();
            })
    })
}
const handleCurrentChange = (val) => {
    formInline.pageNo = val;
    onLoadData();
}
const onDetail = (memberUserId) => {
  formRef.value.open(memberUserId)
}
</script>
